package com.fox.limit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class DecreaseConcurrencyNum {
    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    public boolean decrease(int num){
        return redisTemplate.opsForValue().decrement(LimitConstant.MATRIX_LIMIT_KEY,num)>0;
    }
}
